<?php

include_once '../template/header.php';
try {
    $dbh = new PDO('mysql:host=121.40.41.21;dbname=scb', 'root', 'Primeton2016', array(PDO::ATTR_PERSISTENT => true));
    $dbh->query('set names utf8');

    // 获取昨日的总户总量
    $sql_a = 'SELECT COUNT(*),b.`title`,b.`start_time` FROM sign_table a,class_subject b WHERE a.`class_id`=b.`id` GROUP BY a.class_id';
    $sql_b = 'SELECT COUNT(*) abc,b.name FROM sign_table a,sign_user b WHERE a.`openid`=b.`openid` GROUP BY b.`openid` ORDER BY abc DESC';
    foreach ($dbh->query($sql_a) as $row) {
        var_dump($row);
    }
    foreach ($dbh->query($sql_b) as $result) {
        var_dump($result);
    }

    $dbh = null;
} catch (PDOException $e) {
    print "Error!: " . $e->getMessage() . "<br/>";
    die();
}
include_once '../template/header.php';
?>